pull: fix GLNX_HASH_TABLE_FOREACH_KV regressions
authorJonathan Lebon <jlebon@redhat.com>
Fri, 30 Jun 2017 16:01:56 +0000 (09:01 -0700)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 30 Jun 2017 16:26:53 +0000 (16:26 +0000)
These are regression from #971. We were stuffing a pointer size inside a
variable of integer size. So the assignment was spilling over into other
variables' storage space. Actually use a gpointer and GPOINTER_TO_[U]INT
as was done originally.

Also bump libglnx which has static checks for this error in the future.

Update submodule: libglnx

Closes: #990
Approved by: cgwalters

libglnx
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-repo-pull.c

diff --git a/libglnx b/libglnx
index 01e934c18efdbac071ebc19a8a95916d324970c9..a37e672739197b8a7f3bdfe3f17099fe402f9a98 160000 (submodule)
--- a/libglnx
+++ b/libglnx
@@ -1 +1 @@
-Subproject commit 01e934c18efdbac071ebc19a8a95916d324970c9
+Subproject commit a37e672739197b8a7f3bdfe3f17099fe402f9a98
index 8729b81cb3cf3675ee9d3900a2f9d54da78ee4f4..9ab9a62392ed14cb85e0ec0afc32f358f7e3579c 100644 (file)
@@ -1091,9 +1091,9 @@ ostree_repo_checkout_gc (OstreeRepo        *self,
   if (!to_clean_dirs)
     return TRUE; /* Note early return */
 
-  GLNX_HASH_TABLE_FOREACH (to_clean_dirs, guint, prefix)
+  GLNX_HASH_TABLE_FOREACH (to_clean_dirs, gpointer, prefix)
     {
-      g_autofree char *objdir_name = g_strdup_printf ("%02x", prefix);
+      g_autofree char *objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (prefix));
       g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
 
       if (!glnx_dirfd_iterator_init_at (self->uncompressed_objects_dir_fd, objdir_name, FALSE,
index 31c825b80d7fc295c34484b10ef9f59748386540..fd9e9aff4252697596c28eac876a06c734fa39b6 100644 (file)
@@ -4948,8 +4948,10 @@ ostree_repo_pull_from_remotes_async (OstreeRepo                           *self,
 
   /* Any refs left un-downloaded? If so, we’ve failed. */
   GLNX_HASH_TABLE_FOREACH_KV (refs_pulled, const OstreeCollectionRef*, ref,
-                                           gboolean, is_pulled)
+                                           gpointer, is_pulled_pointer)
     {
+      gboolean is_pulled = GPOINTER_TO_INT (is_pulled_pointer);
+
       if (is_pulled)
         continue;